package com.lc.yunanxin.ui.dialog

import android.content.Context
import android.view.LayoutInflater
import android.view.View
import androidx.databinding.DataBindingUtil
import com.hinnotek.amoeba.R
import com.hinnotek.amoeba.databinding.DialogCurrencyBinding
import com.hinnotek.amoeba.widget.MyCustomDialogBuilder

/**
 * @ProjectName: YunAnXin
 * @Author: RICO
 * @Time: 2020/11/18 14:37
 * @Description:
 *
 */
class Dialogs(var context: Context) {

    /**
     * 通用Dialog
     */
    fun currency(title:String,click: View.OnClickListener?) {
        val dialogBuild = MyCustomDialogBuilder(context)
        val binding = DataBindingUtil.inflate<DialogCurrencyBinding>(LayoutInflater.from(context), R.layout.dialog_currency, null, false)
        dialogBuild.setLayout(binding.root)
        val dialog = dialogBuild.create(R.style.DialogFullTheme)
        binding.cancel.setOnClickListener {
            dialog.dismiss()
        }

        binding.tvOk.setOnClickListener {
            click?.onClick(it)
            dialog.dismiss()
        }

        binding.title.text = title

        dialog.show()
    }

}